<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery.js"></script>
</head>
<body>
    <button>获取值</button>
    <input type="text" class="uname" value="">
    <div class="txt">这是文本</div>
    <script>
        $(function(){
            $(".uname").val("刘德华")
            $("button").click(function(){
                console.log($(".uname").val());
                console.log($(".txt").val());
            })
        })
    </script>
</body>
</html>